#!/bin/bash
set -e

echo $PATH

mkdir -p /data/mongo/config/config{1..3}
mkdir -p /data/mongo/config/logs

mongod -f config/config-17011.conf
mongod -f config/config-17013.conf
mongod -f config/config-17015.conf

mongo --port 17011 << EOF
use admin 
var cfg ={"_id":"configsvr", "members":[ 
    {"_id":1,"host":"172.17.0.4:17011"}, 
    {"_id":2,"host":"172.17.0.4:17013"}, 
    {"_id":3,"host":"172.17.0.4:17015"}] };
rs.initiate(cfg)
rs.status()
EOF
